package com.xinxing.city.recovery.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;


import com.xinxing.city.recovery.R;
import com.xinxing.city.recovery.entitys.AreaSelBean;

import java.util.List;

public class AreaSelAdapter extends ArrayAdapter<AreaSelBean> {

    public AreaSelAdapter(@NonNull Context context, int resource, List<AreaSelBean> objects) {
        super(context, resource,objects);
    }

    @SuppressLint("ResourceAsColor")
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TextView textView = (TextView) convertView;
        if (textView == null) {
            textView = new TextView(getContext());
        }
        textView.setTextColor(R.color.gray1);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP,24);
        textView.setText(getItem(position).getName());

        return textView;
    }
    @SuppressLint("ResourceAsColor")
    @Override
    public View getDropDownView(int position, View convertView, ViewGroup parent) {
        TextView textView = (TextView) convertView;
        if (textView == null) {
            textView = new TextView(getContext());
        }

        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP,24);
        textView.setTextColor(R.color.black3);
        textView.setText(getItem(position).getName());

        return textView;
    }

}
